package com.hgw.Demo06_Singleton.type7;

/**
 * Data time:2021/12/11 13:28
 * StudentID:2019112118
 * Author:hgw
 * Description: 使用枚举
 */
public class SingletonTest07 {

    public static void main(String[] args) {
        Singleton instance1 = Singleton.INSTANCE;
        Singleton instance2 = Singleton.INSTANCE;
        System.out.println(instance1==instance2);
        instance1.sayOK();
    }

}

enum Singleton {
    INSTANCE; //属性
    public void sayOK() {
        System.out.println("OK~");
    }
}